package com.jy.modules.cims.component.common.service;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.HashMap;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jy.platform.core.common.BaseDTO;

import com.jy.modules.cims.data.common.dto.TCMmContractFeeDTO;
import com.jy.modules.cims.data.common.dao.TCMmContractFeeDao;

/**
 * @classname: TCMmContractFeeService
 * @description: 定义  T_C_MM_CONTRACT_FEE 实现类
 * @author:  JY-IT-D001
 */
@Service("com.jy.modules.platform.tcmmcontractfee.service.TCMmContractFeeService")
public class TCMmContractFeeService implements Serializable {

    private static final long serialVersionUID = 1L;
    
	@Autowired
	private TCMmContractFeeDao dao;

	/**
     * @author JY-IT-D001
     * @description: 分页查询 T_C_MM_CONTRACT_FEE列表
     * @date 2016-04-07 15:10:27
     * @param searchParams 条件
     * @return
     * @throws
     */ 
	public List<TCMmContractFeeDTO> searchTCMmContractFeeByPaging(Map<String,Object> searchParams) throws Exception {
		List<TCMmContractFeeDTO> dataList =  dao.searchTCMmContractFeeByPaging(searchParams);
		return dataList;
	}
	/**
     * @author JY-IT-D001
     * @description: 按条件查询T_C_MM_CONTRACT_FEE列表
     * @date 2016-04-07 15:10:27
     * @param searchParams 条件
     * @return
     * @throws
     */
	public List<TCMmContractFeeDTO> searchTCMmContractFee(Map<String,Object> searchParams) throws Exception {
	    List<TCMmContractFeeDTO> dataList = dao.searchTCMmContractFee(searchParams);
        return dataList;
    }
	/**
     * @author JY-IT-D001
     * @description: 查询T_C_MM_CONTRACT_FEE对象
     * @date 2016-04-07 15:10:27
     * @param id
     * @return
     * @throws
     */ 
	public TCMmContractFeeDTO queryTCMmContractFeeByPrimaryKey(String id) throws Exception {
		
		TCMmContractFeeDTO dto = dao.findTCMmContractFeeByPrimaryKey(id);
		
		if(dto == null) dto = new TCMmContractFeeDTO();
		
		return dto;
		
	}

	/**
     * @title: insertTCMmContractFee
     * @author JY-IT-D001
     * @description: 新增 T_C_MM_CONTRACT_FEE对象
     * @date 2016-04-07 15:10:27
     * @param dto
     * @return
     * @throws
     */
	@SuppressWarnings("all")
	public Long insertTCMmContractFee(TCMmContractFeeDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		int count = dao.insertTCMmContractFee(paramMap);
		
		TCMmContractFeeDTO resultDto = (TCMmContractFeeDTO) paramMap.get("dto");
		Long keyId = resultDto.getId();
		return keyId;
	}
	/**
     * @title: updateTCMmContractFee
     * @author JY-IT-D001
     * @description: 修改 T_C_MM_CONTRACT_FEE对象
     * @date 2016-04-07 15:10:27
     * @param paramMap
     * @return
     * @throws
     */
	public void updateTCMmContractFee(TCMmContractFeeDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		dao.updateTCMmContractFee(paramMap);
	}
	/**
     * @title: deleteTCMmContractFeeByPrimaryKey
     * @author JY-IT-D001
     * @description: 删除 T_C_MM_CONTRACT_FEE,按主键
     * @date 2016-04-07 15:10:27
     * @param paramMap
     * @throws
     */ 
	public void deleteTCMmContractFeeByPrimaryKey(BaseDTO baseDto,String ids) throws Exception {
		if(StringUtils.isEmpty(ids)) throw new Exception("删除失败！传入的参数主键为null");
		
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", baseDto);
		paramMap.put("ids", ids);
		dao.deleteTCMmContractFeeByPrimaryKey(paramMap);
	}

}

